//
//  ColorSpaceConvert.h
//  MediaStreamer
//
//  Created by Think on 16/2/14.
//  Copyright © 2016年 Cell. All rights reserved.
//

#ifndef __MediaStreamer__ColorSpaceConvert__
#define __MediaStreamer__ColorSpaceConvert__

#include "MediaDataType.h"

enum ALGORITHM_SOURCE
{
    LIBYUV = 0,
    FFMPEG_SWSCALE = 1,
};

class ColorSpaceConvert
{
public:
    virtual ~ColorSpaceConvert() {}
    
    static ColorSpaceConvert* CreateColorSpaceConvert(ALGORITHM_SOURCE algorithmSource);
    static void DeleteColorSpaceConvert(ColorSpaceConvert* colorSpaceConvert, ALGORITHM_SOURCE algorithmSource);
    
    virtual bool RGBAtoI420(MediaStreamer::VideoFrame* rgba, MediaStreamer::VideoFrame* i420) = 0;

    virtual bool ARGBtoI420(MediaStreamer::VideoFrame* argb, MediaStreamer::VideoFrame* i420) = 0;
    
    virtual bool NV12toI420(MediaStreamer::VideoFrame* nv12, MediaStreamer::VideoFrame* i420) = 0;
    virtual bool NV12toI420_Rotation(MediaStreamer::VideoFrame* nv12, MediaStreamer::VideoFrame* i420, int rotation) = 0;
    virtual bool NV12toI420_Crop_Rotation(MediaStreamer::VideoFrame* nv12, MediaStreamer::VideoFrame* i420, int rotation) = 0;
    virtual bool NV12toI420_Crop_Rotation_Scale(MediaStreamer::VideoFrame* nv12, MediaStreamer::VideoFrame* i420, int rotation) = 0;
    
    virtual bool NV21toI420(MediaStreamer::VideoFrame* nv21, MediaStreamer::VideoFrame* i420) = 0;
    virtual bool NV21toI420_Rotation(MediaStreamer::VideoFrame* nv21, MediaStreamer::VideoFrame* i420, int rotation) = 0;
    virtual bool NV21toI420_Crop_Rotation(MediaStreamer::VideoFrame* nv21, MediaStreamer::VideoFrame* i420, int rotation) = 0;
    virtual bool NV21toI420_Crop_Rotation_Scale(MediaStreamer::VideoFrame* nv21, MediaStreamer::VideoFrame* i420, int rotation) = 0;
    virtual bool NV21toI420_Crop_Rotation_Scale_Mirror(MediaStreamer::VideoFrame* nv21, MediaStreamer::VideoFrame* i420, int rotation) = 0;
};

#endif /* defined(__MediaStreamer__ColorSpaceConvert__) */
